/* ==================================================================   
 * Created [2009-4-27 下午11:32:55] by Jon.King 
 * ==================================================================  
 * TSS 
 * ================================================================== 
 * mailTo:jinpujun@hotmail.com
 * Copyright (c) Jon.King, 2009-2012 
 * ================================================================== 
 */

package com.jinhe.tss.cms.entity;

import java.util.HashMap;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.jinhe.tss.cms.CMSConstants;
import com.jinhe.tss.core.persistence.IEntity;
import com.jinhe.tss.core.web.dispaly.xform.IXForm;

/** 
 * 栏目文章关系实体 
 * 按不同来源可分为四种：0:普通文章 1:分发文章 2:转载文章 3:导入文章
 */
@Entity
@Table(name = "cms_channel_article")
public class ChannelArticle implements IEntity, IXForm {
    
    @EmbeddedId
	private ChannelArticleId id;  // 复合主键 
    
    @Column(nullable = false)
    private Integer articleOrigin = CMSConstants.ARTICLE_COMMON; // 文章来源 0:普通文章 1:分发文章 2:转载文章 3:导入文章
   
    @Column(nullable = false)
    private Integer seqNo;           // 显示顺序
    private Integer isTop = CMSConstants.FALSE; // 是否置顶
    
    private Long    sourceSiteId;    // 源文章的站点id
    private Long    sourceChannelId; // 源文章的栏目id
    private Long    sourceArticleId; // 源文章的文章id
    private String  pathName;        // 源路径名，非文件路径，栏目树的路径， 例: 交行门户/新闻/NBA战况
 
    public ChannelArticleId getId() {
        return id;
    }
 
    public void setId(ChannelArticleId id) {
        this.id = id;
    }
 
    public Integer getArticleOrigin() {
        return articleOrigin;
    }
 
    public void setArticleOrigin(Integer articleOrigin) {
        this.articleOrigin = articleOrigin;
    }
 
    public Integer getSeqNo() {
        return seqNo;
    }
 
    public void setSeqNo(Integer seqNo) {
        this.seqNo = seqNo;
    }
 
    public String getPathName() {
        return pathName;
    }
 
    public void setPathName(String pathName) {
        this.pathName = pathName;
    }
 
    public Long getSourceArticleId() {
        return sourceArticleId;
    }
 
    public void setSourceArticleId(Long sourceArticleId) {
        this.sourceArticleId = sourceArticleId;
    }
 
    public Long getSourceChannelId() {
        return sourceChannelId;
    }
 
    public void setSourceChannelId(Long sourceChannelId) {
        this.sourceChannelId = sourceChannelId;
    }
 
    public Long getSourceSiteId() {
        return sourceSiteId;
    }
 
    public void setSourceSiteId(Long sourceSiteId) {
        this.sourceSiteId = sourceSiteId;
    }
 
    public Integer getIsTop() {
        return isTop;
    }
 
    public void setIsTop(Integer isTop) {
        this.isTop = isTop;
    }

    public Map<String, Object> getAttributesForXForm() {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("channelId", this.id.getChannelId());
        map.put("articleId", this.id.getArticleId());
        map.put("pathName", this.pathName);
        return map;
    }
}

